Inside this archive is a programmatic framework for creating SVG maps, with and
without images for interactive fiction. The framework is written in javascript
and interfaces directly into an SVG file for simplicity.

SVG (Scalable Vector Graphics) is a standard file format for producing vector
graphics. All of the maps have been tested on both the Opera and Firefox 3.0 web
browsers. Other, poorer, browsers like Internet Explorer and Safari have either
no, or limited SVG support.

The interface is pretty self explanatory, by looking at the sample maps it
should be easy to see the calls used.

Template File
First, take the template file (template.svg) and rename it for your purposes.
The template file contains:

	<?xml version="1.0" encoding="UTF-8"?>
	<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
	  "http://www.w3.org/Graphics/SVG/1.1/DTD/svgll-basic.dtd">
	<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve"
	   width="1280" height="1080" xmlns:xlink="http://www.w3.org/1999/xlink
	   ">

These are the required SVG headers to explain to your SVG reader that it is an
SVG document and what flavour of the standard is uses. Don't mess around with
these.

	<script xlink:href="definitions.js" type="text/ecmascript"></script>
	<script xlink:href="mapbuilder.js" type="text/ecmascript"></script>

These import the javascript into the SVG document. definitions.js contains some
globally configurable settings that can be altered for a specific maps (e.g.
room size); all sizes within are in pixels.

mapbuild.js holds the actual code, you shouldn't be required to alter this.

	<g id="map">
	</g>

This assigns a parent container that the map is drawn on. If this is removed
then your map won't display.

	<script type="text/ecmascript">
	<![CDATA[

	// Code goes here

	]]>
	</script>

All the code should go in this block. See below for more details.

	<g id='ToolTip' visibility="hidden">
	   <rect id="ToolTipBox" rx="2" ry="2" class='ToolTipBox' width="200"
	   height="20" fill="yellow" stroke="black" />
	   <text id="ToolTipText" class='ToolTipText' x='4' y='14'
	      style="fill:black;font-family:Verdana,sans serif;font-size:6pt">
	      hello there!</text>
	</g>
	</svg>

This defines the pop up window that appears when you hover over an information
tab. Removing this will stop it appearing.

Concepts
Some concepts are required to create the maps:

Tabs
A tab is a defined area which contains several rooms, jumps, exits and bits of
texts. Several tabs may exist and are commonly used to break up sections of a
map to improve visibility. Tabs do not have to be used.

Rooms
A rooms is generally a single location in the game, usually defined as somewhere
that the protagonist may go. It may have objects within it, exits out of it,
comments on the room, and whether the protagonist is killed upon entering it.
Rooms may also be indicated to show whether the section starts there.

Jumps
A jump is an indicator that going to the jump will take the protagonist to a
separate tab on the map. The jumps are clickable and will change the tab upon
clicking.

Exits
An exit shows the direction that the protagonist may move and whether they are
any potential restrictions on the movement

Text
A text is just a piece of freetext that may be place within a tab to show a
comment.

Co-ordinates
All co-ordinates are given as part of a grid of spaces for rooms, starting from
0,0 (top left).

Functions
The following functions are defined:

addTab(tab, name, number)
Creates a new tab and sets it to the current tab for inserting new objects.
* tab is the internal name of the tab
* name is the name of the tab that will be displayed in the tab bar
* number is the number where the tab will be placed in the tab bar
Example:
addTab("tab1", "The Forest", 1);

setTab(tab)
Sets the current tab for inserting new objects to "tab". Normally this is done
automatically by addTab(); but sometimes it may need to be forced. For example
if you want an untabbed interface, you may do setTab(map)

* tab is the tab to be used for inserting objects
Example:
setTab("tab1");

addRoom(room, name, x, y, image, objects, comments, death)
Creates a new room and sets that as the current room for inserting new exits.
The last four parameters are optional, and if given as a blank string ("") will
be ignored.

* room is the internal id of the room
* x is the x grid location of the text
* y is the y grid location of the text
* image is a filename (from the location of the SVG) to an image for the room
* objects is a string listing any objects in the room
* comments is a string containing any specific comments for the room
* death is a string describing any death that may occur upon entering the room
Example:
addRoom("tab1room1","Bottom of Stairs", 2,3, "images/stairs.png", "Skull",
"To go east, OPEN DOOR", "If shoelaces are undone, your neck will be broken");

setRoom(room)
Sets the current room for inserting new exits to "room". Normally this is done
automatically by addRoom().

* room is the room to be used for inserting exits
Example:
setRoom("room1");

addText(text, x, y)
Creates free text that will be shown on the map instead of another object. Note,
free text takes up as much space as a room or jump (it is essentially a room
without a border).

* text is the text to be added
* x is the x grid location of the text
* y is the y grid location of the text
Example:
addText("To Enchanted Forest",2,3);

addJump(toTab, description, x, y, orientation)
Creates a jump on the current tab to another tab. The jump is clickable and will
redraw the tab.

* toTab is the destination tab
* description is the test that will be printed on the jump
* x is the x grid location of the jump
* y is the y grid location of the jump
* orientation is the direction the tab points in, this is one of North, South,
  East and West and is purely for aesthic reasons.
Example:
addJump("tab2", "Palace", 0, 4, "East");

addExit(direction, mod, oneway, updown, inout)
Creates an exit attached to the current room on the current tab. Obviously you
don't need to compliment exits (e.g. an exit from one room to another only needs
to be done once). It's a good policy to set up a standard, I always make the
room control exits to the South and East of the room. Sometimes you may have to
put in an exit in the opposite direction, e.g. to force the arrow on a one way
exit, you may have to add it as a North exit.

* direction is the direction of the exit: North, South, East, West, NorthEast,
NorthWest, SouthEast or SouthWest
* mod is an indication that a puzzle may need to be solved to go this way. If so
  it should be set to 1.
* oneway indicates that the exit is oneway. If so it should be set to 1.
* updown indicates that the exit is an up and down exit. If so it should be set
  to 1.
* inout indicates that the exit is an in and out exit. If so it should be set to
  1.
Example
addExit("North",1,1,0,1);

connectRooms(room1, room2, mod, oneway)
Connects two rooms with a simple straight line from the nearest edge of room1 to
the nearest edge of room2. This is normally used where rooms may be more than
two grid spaces away.

* room1 is the name of the first room.
* room2 is the name of the second room.
* mod is an indication that a puzzle may need to be solved to go this way. If so
  it should be set to 1.
* oneway indicates that the exit is oneway. If so it should be set to 1.
Example
connectRooms("room5", "room4", 1, 0);

setStartRoom(room)
Indicates which room is started at in the current tab. More than one room may be
set to the start room by repeated calls to the function.

* room is the name of the room.
Example
setStartRoom("room2");

setActiveTab(tab)
Sets the tab indicated to the be the one displayed when the map is loaded. The
default is the last tab created.

* tab is the tab to be displayed.
Example
setActiveTab("tab1");

resizeMap()
Automatically works out and equalises the size of all the tabs. This function
*must* be called if tabs are being used.

Example
resizeMap();

addKey(title, subtitle)
Adds a key to the map. This is automatically place at the top right of the map,
after all objects (or outside the tab area).

* title is the title of the game
* subtitle is a subtitle that may be added
Example
addKey("Prehistoric Time Trip", "Mapped by David Lodge");

Examples
The following example maps are included:

Crown Jewels
	This shows a small map with multiple tabs.
Sorceror of Claymorgue Castle
	This shows a simple, no tabbed map with images.
Myth
	This is a simple maps with multiple tabs and a mix of images and plain rooms.
Ransom
	This is a small map with no tabs.
Rick Hanson 1
	This is a large map with multiple tabs.
Strandrd!
	Another large map with multiple tabs.
Voodoo
	This shows a simple, no tabbed map with images.
Xadomy
	This shows a simple, no tabbed map with no images.


